import axios from "axios";

const instance = axios.create({
  // baseURL: "http://www.liulongbin.top:3005", // 切换线上的地址 // baseURL 解开了 mockjs就要注释
  timeout: 300,
});

export const createAPI = (url, method, data) => {
  let config = {};
  if (method.toUpperCase() === "GET") {
    config.params = data;
  } else {
    config.data = data;
  }

  return instance({
    url,
    method,
    ...config,
  });
};
